function foo() {
  return "yzh"
}

function bar() {
  return 111
}

let flag = true;
let result: any;  //这里使用any类型可以把result赋值给任意确定类型
// let result: unknown  //unknown(未知的) 类型只能赋值给any和unknown类型
if(flag) {
  result = foo()
}else {
  result = bar()
}

let message: string = result;
let num: number = result

console.log(result);
export {}